<nav class="navbar navbar-static-top">
    <div class="logo" data-toggle="push-menu">
        <b>${@Global.getConfig('productName')}</b>
        <small>&nbsp; &nbsp;<i class="fa fa-bars"></i></small>
    </div>
    <%/*<!--%><a href="javascript:" class="sidebar-toggle" data-toggle="push-menu" role="button">
		<span class="sr-only">菜单切换</span><span class="icon-bar"></span>
		<span class="icon-bar"></span><span class="icon-bar"></span>
	</a><%-->*/%>
    <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
            <!--<% include('sysIndex/topMenuCorp.html'){} %>-->
            <li><a href="javascript:" id="fullScreen" title="${text('全屏')}" data-placement="bottom" data-container="body"><i class="fa fa-arrows-alt"></i></a></li>
            <li><a href="javascript:" id="switchSkin" title="${text('切换主题')}" style="margin-top:-1px;" data-placement="bottom" data-container="body"><i class="fa fa-dashboard"></i></a></li>
            <% include('sysIndex/topMenuLang.html'){} %>
            <% include('sysIndex/topMenuOnline.html'){} %>
            <% include('sysIndex/topMenuMsg.html'){} %>
            <% //include('sysIndex/topMenuNotify.html'){} %>
            <% //include('sysIndex/topMenuTask.html'){} %>
            <% include('sysIndex/topMenuUser.html'){} %>
        </ul>
    </div>
    <% if(@Global.getConfig('sys.index.menuStyle', '1') == '2'){ %>
    <div class="navbar-custom-menu pull-left">
        <ul class="nav navbar-nav" id="topMenu">
            <%
            var p = {parentCode: '0', children: false};
            menu.tree(p); print(p.html);
            %>
        </ul>
        <script>
            $(function(){
                $('#topMenu').on('click', '.addTabPage', function (e) {
                    $('#topMenu li').removeClass('active');
                    $(this).closest('li').addClass('active');
                    var code = $(this).data("code");
                    js.cookie('currentMenuCode', code); // 保存当前菜单ID
                    if ($("#leftMenu-" + code).length > 0){
                        $("#leftMenu > ul").hide();
                        $("#leftMenu-" + code).show();
                        refreshSidebar(code);
                    }else{
                        js.ajaxSubmit('${ctx}/index/menuTree?parentCode=' + code
                            + '&t=' + new Date().getTime(), function(data){
                            if (data && data.indexOf('"result":"login"') == -1){
                                $("#leftMenu > ul").hide();
                                $("#leftMenu").append(data);
                                // 如果是初次加载，则选中上次打开的菜单
                                if($('.sidebar-menu').length == 1){
                                    $(window).trigger("hashchange");
                                }
                                refreshSidebar(code);
                            }else{
                                location = '${ctx}/login';
                            }
                        }, 'html');
                    }
                });
                var refreshSidebar = function(code){
                    if(js.trim($("#leftMenu-" + code).text()) == ''){
                        $('.main-sidebar').hide();
                        $('.content-wrapper').css("cssText","margin-left:0!important;");
                        $(window).resize();
                    }else{
                        $('.main-sidebar').show();
                        $('.content-wrapper').css('margin-left', '');
                        $(window).resize();
                    }
                }
                // 激活存储的顶部当前菜单项
                var currentMenuCode = js.cookie('currentMenuCode'), currentMenu;
                if (currentMenuCode && currentMenuCode != ''){
                    currentMenu = $("#topMenu .addTabPage[data-code="+currentMenuCode+"]");
                }
                if (currentMenu && currentMenu.length > 0 && window.location.hash != ''){
                    currentMenu.click();
                }else{
                    $("#topMenu .addTabPage:first").click();
                }
            });
        </script>
    </div>
    <% } %>
</nav>